package com.paomi.client.base;


import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter;
import com.paomi.client.net.Constants;

/**
 * Created by LS on 2017/5/26 0026.
 */

public abstract class BaseLoadMorePresenter<V extends BaseMvpLCEView> extends MvpBasePresenter<V> {
    private int page;
    private int skip;

    public void loadData(boolean pullToRefresh) {
        page = pullToRefresh ? 1 : ++page;
        skip = page * Constants.PAGE_SIZE;
        loadData(page, skip, pullToRefresh);
    }

    /**
     * 加载数据方法
     * @param page  当前要请求的页数
     * @param skip  当前开始的数据索引
     * @param pullToRefresh  是否是下拉刷新
     */
    protected abstract void loadData(int page, int skip, boolean pullToRefresh);
}
